#pragma once

#include <gl\freeglut.h>
#include <gl\glext.h>
#include <vector>

#include "loadTGA.h"

#include "FreeType.h"
#include "Achievement.h"

class CGameMenu
{
public:
	//MENU TYPE
	enum MENU_TYPE
	{
		MAIN_MENU = 0,
		CHARACTER_MENU,
		SETTING_MENU,
		ACHIEVEMENT_MENU,
	//	CREDIT_MENU,
		MISSION_MENU,
		LOBBY_MENU,
		PAUSE_MENU,
		GAMEOVER_MENU,
		INGAME_EASY_MENU_ONE,
		INGAME_EASY_MENU_TWO,
		INGAME_EASY_MENU_THREE,
		SPLASH_SCREEN_MENU,
	};

	//MAIN MENU BUTTON TYPE
	enum MAIN_MENU_BUTTON_TYPE
	{
		CHARACTER_BUTTON = 0,
		LOAD_BUTTON,
		SETTING_BUTTON,
		ACHIEVEMENT_BUTTON,
		//CREDITS_BUTTON,
		EXIT_BUTTON,
	};

	//CHARACTER MENU BUTTON TYPE
	enum CHARACTER_MENU_BUTTON_TYPE
	{
		SWORD_AND_SHIELD_BUTTON = 0,
		GREAT_SWORD_BUTTON,
		DUAL_SWORD_BUTTON,
	};

	//SETTING_BUTTON TYPE
	enum SETTING_BUTTON_TYPE
	{
		BGM_ON_BUTTON = 0,
		BGM_OFF_BUTTON,
	};

	//SHOP BUTTON TYPE
	enum SHOP_BUTTON_TYPE
	{
		SWORD_AND_SHIELD_SHOP_BUTTON = 0,
		GREAT_SWORD_SHOP_BUTTON,
		DUAL_SWORD_SHOP_BUTTON,
		POTION_BUTTON,
	};

	//MISSION BUTTON TYPE
	enum MISSION_DIFFICULTY_BUTTON_TYPE
	{
		EASY_MISSION = 0,
		NORMAL_MISSION,
		HARD_MISSION,
	};

	//MISSION BUTTON TYPE
	enum MISSION_BUTTON_TYPE
	{
		EASY_MISSION_ONE = 0,
		EASY_MISSION_TWO,
		EASY_MISSION_THREE,
		NORMAL_MISSION_ONE,
		NORMAL_MISSION_TWO,
		NORMAL_MISSION_THREE,
		HARD_MISSION_ONE,
		HARD_MISSION_TWO,
		HARD_MISSION_THREE,
	};
private:
	float FrameTime;

	int ArrowKey_x;		//Arrow Key X position
	int ArrowKey_y;		//Arrow Key Y position

	float Menu_Animation_x;
	float Menu_Animation_y;
	float PickChar_Animation_x;
	float PickChar_Animation_y;
	float PickCharWeapon_Animation_x;
	float PickCharWeapon_Animation_y;

	bool VibrateAnimation;
	bool VibrateAnimationTwo;

	bool LoadCharacterAndLobbyTexture;
	bool LoadMissionTexture;
	bool LoadLobbyTexture;
	bool LoadSettingTexture;
	bool LoadAchievementMenuTexture;
	bool LoadCreditsTexture;

	bool ToggleUpButton;
	bool ToggleDownButton;
	bool ToggleLeftButton;
	bool ToggleRightButton;

	//Texture
	TextureImage *BackgroundTexture;
	TextureImage *MainMenuTexture;
	TextureImage *SettingsMenuTexture;
	TextureImage *AchievementsMenuTexture;
	TextureImage *CreditsMenuTexture;
	TextureImage *ButtonTexture;
	TextureImage *CharacterButtonTexture;
	TextureImage *LobbyTexture;
	TextureImage *MissionTexture;

	freetype::font_data Achievement_font;
public:
	CGameMenu(void);	//Constructor
	~CGameMenu(void);	//Destrcutor

	int MenuType;
	int MainMenuButtonType;
	int CharacterButtonType;
	int SettingButtonType;
	int LobbyButtonType;
	int MissionDifficultyButtonType;
	int MissionButtonType;

	bool BGM;

	bool CheckWeapon;

	// Game Menus //
	void RenderMenus(float FrameTime);			//Render all the menus
	
	void DrawMainMenu(void);		//Draw main menu
	void DrawCharacterMenu(void);
	void DrawSettingMenu(void);
	void DrawAchievementMenu(void);
	void DrawCreditsMenu(void);

	void DrawLobbyMenu(void);
	void DrawMissionMenu(void);
	void DrawEasyMap(void);
	void DrawNormalMap(void);
	void DrawHardMap(void);
	void DrawSplashScreenMenu(void);

	// Buttons //
	void DrawMainMenuButton(void);
	void DrawChooseCharacterButton(void);
	void DrawLobbyButton(void);
	void DrawMissonButton(void);
	void DrawSettingButton(void);

	void ButtonUp(void);
	void ButtonDown(void);
	void ButtonLeft(void);
	void ButtonRight(void);
	void CheckEnterButton(void);
	void CheckKeys(void);

	// Arrow key //
	void DrawMenuKey(void);
	void DrawCharKey(void);	
	void DrawSettingKey(void);

	void ArrowCheckButton(void);

	// Animation //
	void MenuButtonAnimation(void);

};
